server:
  port: ${serverPort}

spring:
  application:
    name: ${name}
  mvc:
    pathmatch:
      matching-strategy: ant_path_matcher

<#if needDatabase>
  datasource:
    type: com.alibaba.druid.pool.DruidDataSource
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://${databaseHost!'localhost'}:${databasePort!'3306'}/${databaseName}?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
    username: ${databaseUsername}
    password: ${databasePassword}
    druid:
      initial-size: 5
      min-idle: 5
      max-active: 20
      max-wait: 60000
      time-between-eviction-runs-millis: 60000
      min-evictable-idle-time-millis: 300000
      validation-query: SELECT 1
      test-while-idle: true
      test-on-borrow: false
      test-on-return: false
      pool-prepared-statements: true
      max-pool-prepared-statement-per-connection-size: 20
      filters: stat,wall
      connection-properties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
      stat-view-servlet:
        enabled: true
        url-pattern: /druid/*
        login-username: admin
        login-password: 123456
</#if>

<#if needRedis>
  redis:
    host: ${redisHost!'localhost'}
    port: ${redisPort!'6379'}
    <#if redisPassword?? && redisPassword != "">
    password: ${redisPassword}
    </#if>
    timeout: 5000
    lettuce:
      pool:
        max-active: 8
        max-wait: -1
        max-idle: 8
        min-idle: 0
</#if>

<#if needDatabase>
mybatis-plus:
  type-aliases-package: ${basePackage}.entity
  mapper-locations: classpath:mapper/*.xml
  configuration:
    map-underscore-to-camel-case: true
    cache-enabled: false
    call-setters-on-nulls: true
    jdbc-type-for-null: null
  global-config:
    db-config:
      id-type: auto
      logic-delete-value: 1
      logic-not-delete-value: 0
</#if>

<#if needSwagger>
knife4j:
  enable: true
  basic:
    enable: false
</#if>

<#if needJwt>
jwt:
  header: Authorization
  secret: ${jwtSecret}
  expiration: 604800
  tokenHead: Bearer
</#if>
